
//
//  AllOrdersViewController.m
//  LuxuryGoods
//
//  Created by DCQ on 2018/5/26.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "AllOrdersViewController.h"
#import "AllOrdersListViewController.h"
#import "CustomerServiceViewController.h"
@interface AllOrdersViewController ()
@property(nonatomic, assign) AllOrdersStyle style;
@end

@implementation AllOrdersViewController
- (instancetype)initWithStyle:(AllOrdersStyle)style{
    self = [super init];
    if (self) {
        self.style = style;
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setNavigationItemTitle:@"订单"];

    [self setupRightItem];
    [self setupIndicator];
    switch (self.style) {
        case AllOrdersStyle_all:
            self.currentIndex = 0;
            break;
        case AllOrdersStyle_waitPayment:
            self.currentIndex = 1;
            break;
        case AllOrdersStyle_waitSend:
            self.currentIndex = 2;
            break;
        case AllOrdersStyle_waitGoods:
            self.currentIndex = 3;
            break;
        case AllOrdersStyle_waitComment:
            self.currentIndex = 4;
            break;
        case AllOrdersStyle_refundReview:
            self.currentIndex = 5;
            break;
        default:
            break;
    }
    [self reloadPagerTabStripView];
    
}
- (void)setupRightItem{
    
    UIImage *rightBtnImg = [[UIImage imageNamed:@"bottom_kefu"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]   ;
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithImage:rightBtnImg style:UIBarButtonItemStylePlain target:self action:@selector(rightAction)];
    self.navigationItem.rightBarButtonItem = rightItem;
}

- (void)rightAction{
    CustomerServiceViewController * customerServiceVC = [[CustomerServiceViewController alloc]init];
    [self pushViewController:customerServiceVC];
}
- (void)setupIndicator{
    
    self.buttonBarView.shouldCellsFillAvailableWidth = YES;
 
 
    //设置指示器是否跟随视图滑动
    self.isProgressiveIndicator = YES;
    
    self.isElasticIndicatorLimit = YES;
 
    self.buttonBarView.isAutoCrawlerIndicator = YES;
    //指示器的宽是否和内容等宽
    self.buttonBarView.isAutoIndicatorWidth = NO;
    
    //    self.buttonBarView.leftRightMargin = 10;
    //    self.buttonBarView.scrollsToTop = NO;
    //    self.buttonBarView.bounces = NO;
    // Do any additional setup after loading the view.
    
    self.buttonBarView.selectedBarAlignment = XLSelectedBarAlignmentCenter;
    self.buttonBarView.selectedBar.backgroundColor =  UIColorFromRGB(0xAD9B6A);
    
    self.buttonBarView.indicatorWidth = 20;
    
    self.buttonBarView.backgroundColor = [UIColor whiteColor];
    self.bottomLineView.backgroundColor =  UIColorFromRGB(0xECEEEE);
    self.buttonBarView.bottomLineHeight = 1;
    self.itemColorChangeFollowContentScroll = YES;
    self.itemFontChangeFollowContentScroll = NO;
    self.itemTitleFont = [UIFont systemFontOfSize:16];
//    self.itemTitleSelectedFont = [UIFont systemFontOfSize:18];
}
-(NSArray *)childViewControllersForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController{
    
    AllOrdersListViewController * oneVC = [[AllOrdersListViewController alloc]initWithStyle:AllOrdersListStyle_all];
    AllOrdersListViewController * twoVC = [[AllOrdersListViewController alloc]initWithStyle:AllOrdersListStyle_waitPayment];
    AllOrdersListViewController * threesVC = [[AllOrdersListViewController alloc]initWithStyle:AllOrdersListStyle_waitSend];
    
    AllOrdersListViewController * fourVC = [[AllOrdersListViewController alloc]initWithStyle:AllOrdersListStyle_waitGoods];
    AllOrdersListViewController * fiveVC = [[AllOrdersListViewController alloc]initWithStyle:AllOrdersListStyle_waitComment];
    AllOrdersListViewController * sixVC = [[AllOrdersListViewController alloc]initWithStyle:AllOrdersListStyle_refundReview];
    NSArray * childViewControllers = [NSMutableArray arrayWithObjects:oneVC,twoVC,threesVC,fourVC,fiveVC,sixVC,nil];
    
    return childViewControllers;
}
- (void)gotoWithdrawDepositVC{
    

    
}

- (void)gotoTopupVC{
  
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (UIColor *)getTabTitleColorSelected{
    
    return UIColorFromRGB(0xAD9B6A);
//    return [UIColor purpleColor];
}
- (UIColor *)getTabTitleColorNor{
    return  UIColorFromRGB(0x333333);
//    return [UIColor whiteColor];
}
@end
